#include "stdafx.h"

#include "..\Usage.h"

namespace Fast
{

TESTCLASS(UsageTests)
{
	TESTMETHOD(ReturnsNegativeOne)
	{
		struct NullOutput
		{
			void operator()(const CString&) {}
		} no;
		TDD_VERIFY(-1 == Usage::Display(no));
	}

	TESTMETHOD(CollectUsageInString)
	{
		CString cs;
		class Collect
		{
			CString& m_cs;
		public:
			Collect(CString& cs) : m_cs(cs) {}
			void operator()(const CString& cs)
			{
				m_cs += cs;
			}
		} collect(cs);
		Usage::Display(collect);

		TDD_VERIFY(cs ==
				L"tddConsole usage:\n"
				L"\ttddConsole dirname, or\n"
				L"\ttddConsole dllname <test specifications>\n"
				L"\t\n"
				L"\tdirname - search directories recursively for and run test dlls,\n"
				L"\t          starting in dirname\n"
				L"\tdllname - run the tests in dllname,\n"
				L"\t          subject to <test specifications> options\n"
				L"\t\n"
				L"\t<test specifications>:\n"
				L"\t\n"
				L"\tnamespace1::class1 <namespace2::class2, ...> - run all tests in the namespace1::class1,\n"
				L"\t                                               then namespace2::class2, etc.\n"
				L"\tnamespace1::class1.specifictest1 <namespace2::class2.specifictest2, ...> - run\n"
				L"\t                                               specifictest1 from namespace1::class1, etc.\n"
				L"\ttddConsole dllname -? or /? - dump all test names in specified dll.\n"
					);
	}
};

}
